package edu.umuc.cmsc495_final_project;

import java.io.Serializable;
import java.util.ArrayList;

public class DataBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8170192944139109307L;
	ArrayList<patron> patrons = new ArrayList<patron>();
	ArrayList<employee> employees = new ArrayList<employee>();
	ArrayList<Table> tables = new ArrayList<Table>();
	ArrayList<Table> barStools = new ArrayList<Table>();
	
	ArrayList<Items> food = new ArrayList<Items>();
	ArrayList<String> test = new ArrayList<String>();
	
	RestaurantTime dateCreated;
	String dbName;
	RestaurantTime hoursOfOpOpen;
	RestaurantTime hoursOfOpClose;
	
	double taxRate;
	
	String notes1, notes2, notes3;
	
	public DataBase(){
		//Adding default values
		RestaurantTime dateCreated = new RestaurantTime();
		RestaurantTime hoursOfOpClose = new RestaurantTime();
		RestaurantTime hoursOfOpOpen = new RestaurantTime();
		
		dateCreated.setYear(2011);
		dateCreated.setMonth(12);
		hoursOfOpOpen.setHour(11);
		hoursOfOpClose.setHour(22);
		this.dateCreated = dateCreated;
		this.dbName = "Matchbox";
		this.hoursOfOpClose = hoursOfOpClose;
		this.hoursOfOpOpen = hoursOfOpOpen;
		this.taxRate = 6;
	}
	
	public DataBase(RestaurantTime dateCreated, String dbName, RestaurantTime hoursOfOpOpen,RestaurantTime hoursOfOpClose, double taxRate){
		this.dateCreated = dateCreated;
		this.dbName = dbName;
		this.hoursOfOpClose = hoursOfOpClose;
		this.hoursOfOpOpen = hoursOfOpOpen;
		this.taxRate = taxRate;
	}
	
	public void addNewEmployee(employee noob){
		this.employees.add(noob);
	}
	
	public void addNewPatron(patron guest){
		this.patrons.add(guest);
	}
	
	public void addNewTable(Table table){
		this.tables.add(table);
	}
	
	public void addNewBarStool(Table table){
		this.barStools.add(table);
	}
	
	public void addNotes1(String notes){
		this.notes1 = notes;
	}
	
	public void addNotes2(String notes){
		this.notes2 = notes;
	}
	
	public void addNotes3(String notes){
		this.notes3 = notes;
	}
	
	public void removeEmployee(employee leaving){
		this.employees.remove(employees.indexOf(leaving));
	}
	
	public void removePatron(patron guest){
		this.patrons.remove(patrons.indexOf(guest));
	}
	
	public void removeTable(Table table){
		this.tables.remove(tables.indexOf(table));
	}
	
	public void removeBarStool(Table table){
		this.barStools.remove(tables.indexOf(table));
	}
	
	public void removeNotes1(){
		notes1 = "";
	}
	
	public void removeNotes2(){
		notes2 = "";
	}
	
	public void removeNotes3(){
		notes3 = "";
	}
	
	public ArrayList<employee> getEmployees(){
		return employees;
	}
	
	public ArrayList<patron> getPatrons(){
		return patrons;
	}
	
	public ArrayList<Table> getTables(){
		return tables;
	}
	
	public ArrayList<Table> getBarStools(){
		return barStools;
	}
	
	public String getNotes1(){
		return notes1;
	}
	
	public String getNotes2(){
		return notes2;
	}
	
	public String getNotes3(){
		return notes3;
	}
	
	public void setHoursOfOp(RestaurantTime hoursOfOpOpen,RestaurantTime hoursOfOpClose){
		this.hoursOfOpOpen = hoursOfOpOpen;
		this.hoursOfOpClose = hoursOfOpClose;
	}
	
	public String getHoursOfOp(){
		return hoursOfOpOpen.getHour() + ":" + hoursOfOpOpen.getMinute() + " - " + hoursOfOpClose.getHour() + ":" + hoursOfOpClose.getMinute();
	}
	
	public void setTaxRate(double taxRate){
		this.taxRate = taxRate;
	}
	
	public double getTaxRate(){
		return taxRate;
	}
	
	public void addItems(Items item){
		this.food.add(item);
	}
	
	public ArrayList<Items> getItems(){
		return food;
	}
	
	//
	public void addToTest(String string){
		this.test.add(string);
	}
	public ArrayList<String> getTestString(){
		return test;
	}
	//
}
